package com.leyu.mall.service.goods.impl;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.leyu.mall.common.facade.IGoodsRelationFacade;
import com.leyu.mall.dao.goods.GoodsRelationMapper;
import com.leyu.mall.domain.goods.GoodsRelation;
import com.leyu.mall.service.goods.IGoodsRelationService;

@Service
@Transactional(rollbackFor = Exception.class)
public class GoodsRelationServiceImpl implements IGoodsRelationService,IGoodsRelationFacade {

	@Resource(name = "goodsRelationMapper")
	private GoodsRelationMapper goodsRelationMapper;

	public GoodsRelation getGoodsRelationById(Long entity_id) throws Exception {
		return goodsRelationMapper.getGoodsRelationById(entity_id);
	}

	public void save(List<GoodsRelation> entity) throws Exception {
//		if (entity.getGoodsId() == null) {
			goodsRelationMapper.addGoodsRelation(entity);

//		} else {
//
//			goodsRelationMapper.updateByPrimaryKey(entity);
//		}
	}
	public void deleteGoodsRelation(Long id) throws Exception {
		goodsRelationMapper.deleteGoodsRelation(id);
	}
	public List<GoodsRelation> getAllGoodsRelation() throws Exception {
		return goodsRelationMapper.getAllGoodsRelation();

	}
	
 
	
}